package com.algorithm;

/**
 * @author: sun.hongliang
 * @create: 2019/11/25 14:43
 */
public class MissingNumberTest {

    public static void main(String[] args) {
    }

    public int missingNumber(int[] nums) {
        int length = nums.length;
        int total = length * (length + 1) / 2;
        int s = 0;
        for (int num : nums) {
            s += num;
        }
        return total - s;
    }
}
